<div class="p++" style="max-width:800px;">
<div ng-if="(!object.id && field.in_store) || (object.id && field.in_show)" style="position:relative;" ng-repeat="field in objectConfig.fields">
    <span ng-if="field.null == 'NO'" class="not-null-tip"></span>
    <!--text-field-->
    <lx-text-field ng-if="field.type== 'string' || field.type== 'float' || field.type== 'decimal'  " label="{{field.comment || field.name}}" >
        <input type="text"  ng-model="object[field.name]" >
    </lx-text-field>

    <!--textare-field-->
    <lx-text-field ng-if="field.type == 'text'" label="{{field.comment || field.name}}" >
        <textarea ng-model="object[field.name]" ></textarea>
    </lx-text-field>

    <!-- content-field -->
    <div ng-if="field.type == 'fulltext' "style="font-size:0.5em;color:gray;margin-top:10px;width:90%;">
        <p>{{field.comment || field.name}}</p>
        <div  class="ueditor" config="ueditorConfig" ng-model="object[field.name]" ></div>                  
    </div>

    <!--int-field-->
    <lx-text-field ng-if="field.type == 'number' && !field.relate" label="{{field.comment || field.name}}" disabled="field.key == 'PRI'" >
        <input type="text"  ng-disabled="field.key == 'PRI'" ng-model="object[field.name]">
    </lx-text-field>

    <!--datetime-field-->
    <lx-text-field ng-if="field.type == 'datetime'" label="{{field.comment || field.name}} | 格式：2015-09-02 17:46:59" >
        <input type="text"  ng-model="object[field.name]" >
    </lx-text-field>
    
    <!-- file upload -->
    <div ng-if="field.type == 'img' || field.type == 'file'" >
        
        <button style="float:right;position:relative;top:30px;" ng-file-select ng-file-change="upload($files,object,field.name)" class="btn btn--s btn--blue-grey btn--raised" lx-ripple><i class="mdi mdi-upload "></i>&nbsp;上传</button> 
        <lx-text-field  label="{{field.comment || field.name}}" >
            <input ftype="text"  ng-model="object[field.name]" >   
        </lx-text-field>
    </div>

    <!--bool-field-->
    <div  ng-if="field.type == 'boolean' " style="margin-top:15px;">
        <input type="checkbox" id="switch_{{field.name}}" class="switch__input " ng-model="object[field.name]" >
        <label for="switch_{{field.name}}" class="switch__label">{{field.comment || field.name}}</label>
    </div>

    <!--select-->
    <lx-select ng-if="field.type == 'relate'" ng-model="object[field.name]" placeholder="{{field.relate.comment || field.relate.name}}"
               choices="ajax.list[field.relate.table]"  loading="{{ ajax.loading }}" ng-init="ajax.init(field.relate)"
               filter="ajax.update(field.relate, newValue, oldValue)"
               min-length="0" allow-clear="true" selection-to-model="ajax.toModel(field.relate, data, callback)"
               model-to-selection="ajax.toSelection(field.relate, data, callback)">
        <label style="font-size:12px;color:#979797;">{{field.relate.comment || field.name}}</label>
        <lx-select-selected>
            {{ $selected[field.relate.select] }}
        </lx-select-selected>

        <lx-select-choices>
            {{ $choice[field.relate.select] }}
        </lx-select-choices>
    </lx-select>

    <!--select-->
    <lx-select ng-if="field.type == 'enum'" ng-model="object[field.name]" placeholder="{{field.comment || field.name}}" choices="enumSelect.list[field.name]" selection-to-model="enumSelect.toModel(data, callback)" ng-init="enumSelect.init(field.name,field.enum)" model-to-selection="enumSelect.toSelection(field.enum,data, callback)">
        <label style="font-size:12px;color:#979797;">{{field.comment || field.name}}</label>
        <lx-select-selected>
            {{ $selected["value"] }}
        </lx-select-selected>

        <lx-select-choices>
            {{ $choice["value"] }}
        </lx-select-choices>
    </lx-select>            
    
</div>
    <div style="text-align:right;">
        <button class="btn btn--m btn--blue-grey  btn--raised" ng-click="store(object)" ng-if="!object.id" lx-ripple>添加</button>
        <button class="btn btn--m btn--blue-grey  btn--raised" ng-click="update(object)" ng-if="object.id" lx-ripple>更新</button>
    </div>
</div>